In [ ]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
In [3]:
count_SA = df.value_counts(df['Has SA'])
In [4]:
fig = px.pie(data_frame = count_SA, values = count_SA.values, names = count_SA.index, title = 'SA Presence on Opps') 
fig.show()
In [5]:
high_val_deals_df = pd.read_csv('WinLossOnHighValDeals.csv')
high_val_deals_df.head()
Out[5]:
SA Status Stage OppCount WinLossRate
0 No SA Involved Lost 534 86.688312
1 No SA Involved Live 82 13.311688
2 SA Involved Lost 1603 85.084926
3 SA Involved Live 281 14.915074
In [6]:
fig = px.bar(data_frame = high_val_deals_df,
             x = 'SA Status',
             y = 'OppCount',
             color = 'Stage',
             barmode = 'group',
             text = 'OppCount',
             title = 'Won and Lost Opps By SA Status'
)
fig.show()
In [7]:
# Create DF of our SQL query for 'Find the pipeline stage where most deals are falling through'
data = {
    'Stage Lost': [
        'Lost @ Discovery',
        'Lost @ Educating',
        'Closed Won',
        'Lost @ Validating Fit',
        'Lost @ Negotiations',
        'Lost @ Onboarding'
    ],
    'Opportunity Count': [
        3199,
        2410,
        1790,
        1545,
        843,
        213
    ]
}

# Create the DataFrame
df = pd.DataFrame(data)
df.head()
Out[7]:
Stage Lost Opportunity Count
0 Lost @ Discovery 3199
1 Lost @ Educating 2410
2 Closed Won 1790
3 Lost @ Validating Fit 1545
4 Lost @ Negotiations 843
In [8]:
fig = px.bar(data_frame = df,
            x = 'Stage Lost',
            y = 'Opportunity Count',
            text = 'Opportunity Count',
            title = 'Last Stage Reached')
fig.show()
In [9]:
last_stage_reached_df = pd.read_csv('LastStageReached.csv')
last_stage_reached_df.head()
Out[9]:
Last Stage Reached SA_Involved CountOpps
0 Lost @ Discovery Amy 19
1 Lost @ Validating Fit Amy 15
2 Lost @ Discovery Andre 166
3 Lost @ Educating Andre 125
4 Lost @ Discovery Anna 40
In [10]:
pivot_df = last_stage_reached_df.pivot(index='SA_Involved', columns='Last Stage Reached', values='CountOpps')

pivot_df.plot(kind='bar', stacked=True, figsize=(10, 6))
plt.xlabel('SA Involved')
plt.ylabel('Count of Opportunities')
plt.title('Count of Opportunities by Last Stage Reached and SA Involved')
plt.legend = 'Last Stage Reached'
plt.show()